package com.example.zhengwei.base.draw;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

/**
 * Created by zhengwei on 2015/10/23.
 */
public class MyView extends View{
    private static final String TAG = MyView.class.getSimpleName();
    public MyView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        Log.d(TAG, "onMeasure w:" + getMeasuredWidth() + " h:" + getMeasuredHeight());
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        Log.d(TAG, "onLayout left:" + left + " top:" + top + " right:" + right + " bottom:" + bottom);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        setVisibility(View.GONE);
        return super.onTouchEvent(event);
    }
}
